<?php
header("Content-Type:text/html;charset=utf-8");
error_reporting(E_ALL & ~E_NOTICE);
session_start();
include('conn.php');
$goodsname = $_GET['goodsname'];
$storename = $_GET['storename'];
$picture=$_GET['picture'];
$price =$_GET['price'];
$username=$_SESSION['username'];
$goods = $_SESSION['goods']; 
/*$goods[$goodsname]['goodsname'] = $goodsname;
$goods[$goodsname]['storename'] = $storename;
$goods[$goodsname]['price'] =$price;
$_SESSION['goods'] = $goods;*/
if(!empty($storename)){
$sql="insert into collection (storename,goodsname,price,username,picture) values ('$storename','$goodsname','$price','$username','$picture')";}
else{
	$sql="insert into collection (storename,goodsname,price,username,picture) values ('随机采购','$goodsname','$price','$username','$picture')";
}
$result = mysqli_query($conn,$sql);
echo "<script> alert('收藏成功');parent.location.href='collection.php';       </script>";
?>
